<?php
class Quantri_Model_KhuVuc extends Zend_Db_Table_Abstract
{
    protected $_name="khuvuc";
    protected $_primary="Id";
    
    var $Id, $Ten,$TrangThai;
    
    public function __construct() {
    	$this->_name = Zend_Registry::get('tablePrefix') . $this->_name;
    		
    	parent::__construct();
    }
    
    
    public function GetAll() {
    	 
    	$data = $this->fetchall();
    	return $data;
    }
    
    public function themkhuvuc()
    {
    	$data = array(
    			'Ten' 	=> $this->Ten,    			
    			'TrangThai' => $this->TrangThai
    	);
    	if($this->Id=="-1")
        	$this->insert($data);
       	else
       	    $this->update($data, "Id = '$this->Id'");
    }
    
    public function xoakhuvuc($id)
    {
    	$this->delete("id='". $id . "'");
    }
    public function GetById()
    {
    	return $this->fetchAll("Id='$this->Id'", "", 1)->toArray();
    }
}